package com.share.thread.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @desc:
 * @author:caifan
 * @date:2022/2/27
 */
public class ThreadPool01 {
    public static void main(String[] args) {
        ExecutorService poolExecutor = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 1000; i++) {
            poolExecutor.execute(new Task01());
        }
    }
}

class Task01 implements Runnable {

    @Override
    public void run() {
        System.out.println("thread-name:" + Thread.currentThread().getName());
    }
}
